<?php
// functions for front-end uses
global $rwp;

//add_action('the_content', array(&$rwp, "rw_display_post_rating"));


function the_fb_button($url = '') {
    global $post;

	if ( in_array($post->post_type, array('video', 'music')) ) {
		if ( empty($url) ) {
			$url = get_permalink();
		}
		$html = "<iframe src='http://www.facebook.com/plugins/like.php?href=" . $url ."&amp;layout=button_count&amp;show_faces=true&amp;width=200&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=80' scrolling='no' frameborder='0' style='border:none; overflow:hidden; height:20px;' allowTransparency='true'></iframe>";
	}
	
	echo $html;
}

function the_rw_iframe($post_id = 0)
{
	global $post;
	if ( ! $post_id ) {
		$post_id = $post->ID;
	}
	$url = WV_URLPATH.'/lib/rw/iframe.php?post_id='.$post_id;
	$html = "<iframe src='" . $url ."' scrolling='no' frameborder='0' style='border:none; overflow:hidden; height:28px;' allowTransparency='true'></iframe>";
	echo $html;
}

function wv_trim_excerpt($text, $length = 30, $excerpt = '...') {
    $words = explode(' ', $text, $length + 1);
    if (count($words) > $length) {
        array_pop($words);
        array_push($words, $excerpt);
        $text = implode(' ', $words);
    }
    return $text;
}

?>
